Practical Lab 2 - Data Visualization and Publication¶

Matplotlib Example

This is an example showing how to control bar color and legend entries using the color and label parameters of bar.¶
In [6]:
import matplotlib.pyplot as plt

fig, ax = plt.subplots()

fruits = ['apple', 'blueberry', 'cherry', 'orange']
counts = [40, 100, 30, 55]
bar_labels = ['green', 'blue', 'red', 'orange']
bar_colors = ['tab:green', 'tab:blue', 'tab:red', 'tab:orange']

ax.bar(fruits, counts, label=bar_labels, color=bar_colors)  # The "ax.bar" function is used to create the bar chart

ax.set_ylabel('fruit supply')  # The "ax.set_ylabel" is used to set the labels for the y-axis
ax.set_title('Fruit supply by kind and color') # This function set the title of the chart
ax.legend(title='Fruit color') # this will create a legend for bar chart

plt.show() # the "plt.show()" function is used to display the chart.

Plotly Example

Scatter plot for different species sepal length and sepal width using plotly¶
In [1]:
import plotly.express as px
import plotly

plotly.offline.init_notebook_mode()
df = px.data.iris()
df["e"] = df["sepal_width"]/100

# Creating a scatter plot using Plotly Express
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species", error_x="e", error_y="e")
fig.show()

Seaborn Example

Scatterplot with continuous hues and sizes¶
In [1]:
import seaborn as sns
sns.set_theme(style="whitegrid")

planets = sns.load_dataset("planets")

# Create a cubehelix color palette
cmap = sns.cubehelix_palette(rot=-.2, as_cmap=True)

# Create a relational plot using relplot
g = sns.relplot(
    data=planets,
    x="distance", y="orbital_period",
    hue="year", size="mass",
    palette=cmap, sizes=(10, 200),
)
g.set(xscale="log", yscale="log")
g.ax.xaxis.grid(True, "minor", linewidth=.25)
g.ax.yaxis.grid(True, "minor", linewidth=.25)
g.despine(left=True, bottom=True)
Out[1]:
<seaborn.axisgrid.FacetGrid at 0x1dbff1a7f90>

A Hyperlink

Researchers at Kyushu University, in collaboration with Osaka University and the Fine Ceramics Center, have developed a framework that uses machine learning to speed up the discovery of materials for green energy technology.¶

Machine learning method speeds up discovery of green energy materials

An Image

Using above approach, the researchers identified and successfully synthesized new candidate materials for use in solid oxide fuel cell - A devices that can generate energy using fuels like hydrogen, which don't emit carbon dioxide¶

New candidate materials for use in solid oxide fuel cell

A Table

Artificial Intelligence (AI) Market in the U.S. 2023-2030¶
Year Market Size (In Billion USD)
2022 $103.7
2023 $123.1
2024 $146.1
2025 $173.6
2026 $201.0
2027 $242.4
2028 $292.9
2029 $353.7
2030 $415.8

This table is created by taking data from Precedence Research.